-
Notifications
You must be signed in to change notification settings - Fork 32
Entity miners Initial Infra #633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: refactor/price-fetcher
Are you sure you want to change the base?
Conversation
🤖 Claude AI Code ReviewLast reviewed on: 14:23:47 SummaryThis PR introduces an "Entity Miners" feature that allows a single entity hotkey to manage up to 500 subaccounts (synthetic hotkeys) for trading. The implementation adds entity management infrastructure following existing RPC patterns, with components for entity registration, subaccount creation, challenge period assessment, debt ledger aggregation, and validator synchronization. ✅ Strengths
|
0434391 to
c32122e
Compare
Fixes bug where get_perf_ledgers_path() incorrectly returned .pkl path, causing migrate_perf_ledgers_to_compressed() to migrate perf_ledgers.json to perf_ledgers.pkl instead of perf_ledgers.json.gz. This created orphaned .pkl files with misleading extensions (containing gzip JSON, not pickle).
- Move validator_broadcast_base.py from shared_objects/ to vali_objects/
- Better location for validator-specific functionality
- Update all imports across ValidatorContractManager, AssetSelectionManager, EntityManager
SIMPLIFICATION:
- Remove dynamic secrets loading from verify_broadcast_sender()
- MOTHERSHIP_HOTKEY is now configured directly in ValiConfig
- Clearer error messages when configuration is missing
- Remove unnecessary ValiUtils import
- Simplify verification logic from ~22 lines to ~18 lines
CLARITY:
- Rename 'wallet' to 'vault_wallet' throughout broadcast system
- Less ambiguous than generic 'wallet' name
- Matches existing vault_wallet naming in ValidatorContractManager
- Update parameter, instance variable, property, and all usages
- Update documentation and code examples
BUG FIX:
- Fix AssetSelectionManager.receive_asset_selection_update()
- Correct asset_selection_data.get("") → .get("asset_selection")
- Bug would have caused asset selection broadcasts to fail silently
Files Changed:
- vali_objects/validator_broadcast_base.py (moved + simplified + renamed)
- vali_objects/contract/validator_contract_manager.py (import + parameter)
- vali_objects/utils/asset_selection/asset_selection_manager.py (import + parameter + bug fix)
- entitiy_management/entity_manager.py (import + parameter)
- shared_objects/BROADCAST_REFACTORING.md (documentation updates)
Benefits:
- Better code organization (validator code in vali_objects/)
- Simpler verification logic (single source of truth for MOTHERSHIP_HOTKEY)
- Clearer naming (vault_wallet vs ambiguous wallet)
- Asset selection broadcasts now work correctly
- All files compile successfully
f868269 to
fca6705
Compare
c18ec70 to
6021496
Compare
6021496 to
d8ebcda
Compare
…ter filtering
Replace hard-coded parameter list with dynamic introspection to filter
SubtensorOpsServer initialization parameters. This makes the code more
maintainable and automatically adapts to signature changes.
Changes:
- Add inspect-based parameter filtering in ServerOrchestrator
- Dynamically discover accepted parameters using inspect.signature()
- Remove hard-coded parameter list ['config', 'wallet', 'is_miner', ...]
- Add debug logging for filtered parameters
- Enhance TESTING mode support in ServerOrchestrator
- Create mock config/wallet for SubtensorOpsServer in TESTING mode
- Add minimal test config for entity, contract, asset_selection, weight_calculator
- Provide test hotkey and is_mainnet=False for weight_calculator
- Fix test compatibility in test_metagraph_updater.py
- Rename position_inspector → position_manager (7 occurrences)
- Update helper method _create_mock_position_manager()
- All 12 tests now passing
- Update neurons/miner.py and neurons/validator.py
- Integrate with ServerOrchestrator neuron startup pattern
- Refactor SubtensorOpsServer initialization
- Improve parameter handling for different modes (MINER/VALIDATOR/TESTING)
…ture
Centralize test mock creation and refactor weight calculator to follow
manager-server pattern, improving separation of concerns and testability.
Test Infrastructure:
- Add TestMockFactory utility (shared_objects/rpc/test_mock_factory.py)
for centralized creation of mock configs, wallets, and hotkeys
- Move mock creation from ServerOrchestrator to individual servers
(ContractServer, AssetSelectionServer, EntityServer, WeightCalculatorServer,
SubtensorOpsServer now self-manage mocks when running_unit_tests=True)
- Add test support to Miner class with running_unit_tests parameter
- Add test mode to PositionInspector (skips network calls)
- Add mock validator responses to PropNetOrderPlacer for testing
Weight Calculator Refactoring:
- Rename SubtensorWeightSetter → WeightCalculatorManager (manager pattern)
- Refactor WeightCalculatorServer to delegate business logic to manager
- Simplify server implementation (-275/+91 lines)
- Manager creates own RPC clients internally (forward compatibility)
- Update imports in tests and runnable scripts
Benefits:
- Better separation of concerns (servers manage own dependencies)
- DRY principle (shared TestMockFactory)
- Consistent manager-server pattern across codebase
- Improved testability with minimal production code impact
- Easier maintenance when requirements change
Taoshi Pull Request
Description
This PR introduces an "Entity Miners" feature allowing a single entity hotkey to manage multiple subaccounts (synthetic hotkeys) for trading. The implementation follows existing RPC patterns, adds comprehensive entity management logic, and integrates with the validator/metagraph systems.
Related Issues (JIRA)
[Reference any related issues or tasks that this pull request addresses or closes.]
Checklist
Reviewer Instructions
[Provide any specific instructions or areas you would like the reviewer to focus on.]
Definition of Done
Checklist (for the reviewer)
Optional: Deploy Notes
[Any instructions or notes related to deployment, if applicable.]
/cc @mention_reviewer